package database

import (
	"demo/models"

	"github.com/sirupsen/logrus"
)

func GetPaymentById(paymentId int) (*models.Payments, error) {
	payment := &models.Payments{
		Id: paymentId,
	}
	exist, err := engine.Where("id = ?", paymentId).Get(payment)
	if err != nil {
		logrus.Error(err)
		return nil, err
	}
	if !exist {
		return nil, ErrNotFound
	}
	return payment, nil
}
